package JVM;

import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

public class a1b2 {

    static Thread t1=null,t2=null,t3=null;
    public static void main(String[] args) {
        char[] c1={'a','b','c','d','e','f'};
        char[] c2="12345".toCharArray();
        t1=new Thread(()->{
            for (int i=0;i<c1.length;i++){
                System.out.println(1);
                LockSupport.unpark(t2);
                LockSupport.park();
            }
        });
        t2=new Thread(()->{
            for (int i=0;i<c2.length;i++){
                LockSupport.park();
                System.out.println(2);
                LockSupport.unpark(t3);
            }
        });
        t3=new Thread(()->{
            for (int i=0;i<c2.length;i++){
                LockSupport.park();
                System.out.println(3);
                LockSupport.unpark(t1);
            }
        });
        t1.start();;
        t2.start();

    }

}
